const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const materializedPlugin = require('mongoose-materialized');
const mongoosePaginate = require('mongoose-paginate');
const ObjectId = Schema.ObjectId;

// 定义一个普通的数据模型
var NewsSchema = new Schema({
    title:String,
    ftitle:String,
    author:String,
    content:String,
    data:{type:Date,default:Date.now},
    cateId:ObjectId
});

// 将数据模型应用插件
NewsSchema.plugin(materializedPlugin);
NewsSchema.plugin(mongoosePaginate);

module.exports = mongoose.model('News', NewsSchema,'news');